import React from 'react'
import ReactDOM from 'react-dom'
import './modal.css'

class ProtalsDemo extends React.Component {
    // constructor(props) {
    //     super(props)
    // }
    render() {
        // return <div>
        //     <h3>Protals</h3>
        //     {/* 正常渲染 */}
        //     <div className='modal'>
        //         {this.props.children} {/* vue slot */}
        //     </div>
        // </div>
        return  ReactDOM.createPortal(
            <div className='modal'>{this.props.children}</div>,
            document.body
        )
    }
}

export default ProtalsDemo